package utils;

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;

public class KeyUtility {


	public static KeyPair GenerateKeys(int length,String algo,String hashAlgo, String keyALgo){
		KeyPairGenerator keyGen = null;
		try {
			keyGen = KeyPairGenerator.getInstance(keyALgo);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		keyGen.initialize(length);
		KeyPair keypair = keyGen.generateKeyPair();
		return keypair;
	}
	
	public static PublicKey getPublicKey(KeyPair keypair){
		return keypair.getPublic();
	}
	
	public static PrivateKey getPrivateKey(KeyPair keypair){
		return keypair.getPrivate();
	}
	
	
}
